<?php

elgg_register_action("question/save", elgg_get_plugins_path() . "question/actions/question/save.php");
elgg_register_action("question/addQuestion", elgg_get_plugins_path() . "question/actions/question/addQuestion.php");
elgg_register_action("question/New", elgg_get_plugins_path() . "question/actions/question/New.php");


elgg_register_page_handler('question', 'question_page_handler');



elgg_register_event_handler('init', 'system', 'question_init');

function question_init() {
    // add a site navigation item
    $item = new ElggMenuItem('question', elgg_echo('question:title'), 'question/addQuestion');
    elgg_register_menu_item('site', $item);
}

function question_page_handler($segments) {
    switch ($segments[0]) {
        default :
        case 'addQuestion' :
            include elgg_get_plugins_path() . 'question/pages/question/addQuestion.php';
            break;

        case 'add' :
            include elgg_get_plugins_path() . 'question/pages/question/add.php';
            break;
        case 'New' :
            include elgg_get_plugins_path() . 'question/pages/question/New.php';
            break;
        case 'allQuestion' :
            include elgg_get_plugins_path() . 'question/pages/question/allQuestion.php';
            break;
    }

    return true;
}

